package com.msh.frame.client.common;

import lombok.Getter;
import lombok.ToString;

/**
 * @author shihu 通用返回信息码
 * @author shihu
 */
@Getter
@ToString
public class ErrorCode {

  public static ErrorCode BIZ_ERROR = new ErrorCode(4000000, "处理业务异常");
  public static ErrorCode CLIENT_ERROR = new ErrorCode(40000001, "客户端错误");
  public static ErrorCode PARAM_ERROR = new ErrorCode(40000002, "参数错误");
  public static ErrorCode PARAM_NOT_MATCHING = new ErrorCode(40000003, "未匹配到相关数据,刷新后再试");
  public static ErrorCode NO_AUTH = new ErrorCode(40000004, "没有权限");
  public static ErrorCode NO_PAGE = new ErrorCode(40000005, "请求地址错误");
  public static ErrorCode NO_DATA = new ErrorCode(40000006, "缺少数据信息");
  public static ErrorCode UNKNOWN_ERROR = new ErrorCode(40000007, "未知异常");
  public static ErrorCode BAD_REQUEST = new ErrorCode(40000008, "请求无效");
  public static ErrorCode REQUEST_ERROR = new ErrorCode(40000009, "请求错误");
  public static ErrorCode MISS_PARAM = new ErrorCode(40000010, "缺少参数");
  public static ErrorCode REQUEST_METHOD_ERROR = new ErrorCode(40000011, "请求方法错误");
  public static ErrorCode DB_INSERT_EMPTY = new ErrorCode(40000012, "数据库新增数据为空");
  public static ErrorCode SYSTEM_ERROR = new ErrorCode(50000000, "系统错误");
  public static ErrorCode SERVICE_ERROR = new ErrorCode(50000001, "服务错误");

  private Integer code;
  private String msg;

  public ErrorCode(Integer code, String msg) {
    this.code = code;
    this.msg = msg;
  }

  public ErrorCode appendMes(String str) {
    return new ErrorCode(this.code, this.msg + ": " + str);
  }
}
